//
//  DDEmoticonPackage.swift
//  XLWB
//
//  Created by MacBook on 16/7/10.
//  Copyright © 2016年 MacBook. All rights reserved.
//

import UIKit
import YYModel
class DDEmoticonPackage: NSObject {
//表情包模型
    
    // 表情包的分组名
    var groupName: String?
    // 表情包目录
    var directory: String? {
        didSet {
            guard let directory = directory,
                path = Bundle.main.pathForResource("HMEmoticon.bundle", ofType: nil),
                bundle = Bundle(path: path),
                infoPath = bundle.pathForResource("info.plist", ofType: nil, inDirectory: directory),
                array = NSArray(contentsOfFile: infoPath) as? [[String: String]],
                models = NSArray.yy_modelArray(with: DDEmoticon.self, json: array) as? [DDEmoticon]
                
                else {
                    return
            }
 
            // 遍历 models 数组
    
            for m in models {
                m.directory = directory
            }
            // 设置表情模型数组
            emoticons += models
        }
    }

    // 懒加载的表情模型的空数组
    lazy var emoticons = [DDEmoticon]()
    
    override var description: String {
        return yy_modelDescription()
    }
}

    
    
    
    

